主题
SortFields (对象)
SortFields 集合是 SortField 对象的集合。开发人员可以使用该集合存储工作簿、列表和自动筛选的排序状态。
示例
python
#本示例为活动工作表创建两个新的排序字段
def test():
Application.ActiveSheet.Sort.SortFields.Add(Range("A1"), None, xlDescending)
Application.ActiveSheet.Sort.SortFields.Add(Range("B1"), None, xlDescending)
python
#本示例清除第一张工作表上所有的 SortField 对象,并创建新的排序字段
def test():
Application.Sheets.Item(1).Sort.SortFields.Clear()
Application.Sheets.Item(1).Sort.SortFields.Add(Range("A1:A11"), xlSortOnValues, xlAscending)